﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Business.Dal
{
    public class Tools
    {
        private static SqlConnection con { get; set; }


        public static SqlConnection Connection()
        {
            if (con == null)
            {
                con = new SqlConnection();
                try
                {
                   // con.ConnectionString = "Data Source=.;Initial Catalog=sahibinden;Integrated Security=SSPI";
                    con.ConnectionString = "Data Source=10.5.25.24;Initial Catalog=SahibindenYeni;User Id=hakan;Password=123;";
                }
             
                catch (Exception ex)
                {

                    throw;
                }
            }


            return con;
        }

        public static void Open()
        {
            if (con.State != System.Data.ConnectionState.Open)
            {
                con.Open();
            }
        }

        public static void Close()
        {
            con.Close();
        }

    }
}
